import * as service from "@/service";
import { IStar1, IStar2 } from "./interface";
const star1: IStar1 = {
  namespaced: true,
  state: {
    stars: [],
  },
  actions: {
    async getstar({ commit }, params) {
      const res = await service.star1(params);
      const action = {
        type: "GET_STAR",
        res: res,
      };
      commit(action);
    },
  },
  mutations: {
    GET_STAR(state, { res }) {
      state.stars = res;
    },
  },
};
const star2: IStar2 = {
  namespaced: true,
  state: {
    stars: [],
  },
  actions: {
    async getstar({ commit }, params) {
      const res = await service.star2(params);
      const action = {
        type: "GET_STAR",
        res: res,
        id: params.floor_id,
      };
      commit(action);
    },
  },
  mutations: {
    GET_STAR(state, { res }) {
      state.stars.push(res);
    },
  },
};
export { star1, star2 };
